package org.code.mallspringboot.service.impl;

import org.code.mallspringboot.dto.PmsEchoDto;
import org.code.mallspringboot.mapper.PmsBrandMapper;
import org.code.mallspringboot.mapper.PmsProductMapper;
import org.code.mallspringboot.pojo.PmsProduct;
import org.code.mallspringboot.pojo.PmsSkuStock;
import org.code.mallspringboot.service.PmsProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PmsProductServiceImpl implements PmsProductService {

    @Autowired
    private PmsProductMapper pmsProductMapper;

    @Override
    public List<PmsProduct> selectPage(int pageNum, int pageSize, String keyword, Integer publishStatus, Integer verifyStatus, String productSn,
                                       Integer productCategoryId, Integer brandId) {
        return pmsProductMapper.selectPage((pageNum - 1) * pageSize, pageSize, keyword, publishStatus,
                verifyStatus, productSn, productCategoryId, brandId);
    }

    @Override
    public int total(String keyword,Integer publishStatus,Integer verifyStatus,String productSn,
                     Integer productCategoryId,Integer brandId) {
        return pmsProductMapper.total(keyword, publishStatus, verifyStatus, productSn, productCategoryId, brandId);
    }

    @Override
    public int update_publishStatus(int id, int publishStatus) {
        return pmsProductMapper.update_publishStatus(id, publishStatus);
    }

    @Override
    public int update_newStatus(int id, int newStatus) {
        return pmsProductMapper.update_newStatus(id, newStatus);
    }

    @Override
    public int update_recommendStatus(int id, int recommendStatus) {
        return pmsProductMapper.update_recommendStatus(id, recommendStatus);
    }

    @Override
    public List<PmsSkuStock> selectByIdAndKeyword(int id, String keyword) {
        return pmsProductMapper.selectByIdAndKeyword(id, keyword);
    }

    @Override
    public int deleteStatus(int id, int deleteStatus) {
        return pmsProductMapper.deleteStatus(id, deleteStatus);
    }

    @Override
    public int update(int productId, String skuCode, double price, Integer stock, Integer lowStock) {
        return pmsProductMapper.update(productId, skuCode, price, stock, lowStock);
    }

    @Override
    public PmsEchoDto selectPmsProduct(int id) {
        return pmsProductMapper.selectPmsProduct(id);
    }

    @Override
    public int update_submit(PmsEchoDto pmsEchoDto) {
        return pmsProductMapper.update_submit(pmsEchoDto);
    }

    @Override
    public int add(PmsEchoDto pmsEchoDto) {
        return pmsProductMapper.add(pmsEchoDto);
    }
}
